<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="{{=T.accepted_language or 'br'}}">
<head>
    <title>{{=response.title or request.application}}</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    {{response.files.append(URL(r=request,c='static',f='js/ckeditor/ckeditor.js'))}}
    {{response.files.append(URL(r=request,c='static',f='jquery.dataTables.min.js'))}}
    {{response.files.append(URL(r=request,c='static',f='demo_table.css'))}}
    {{extend 'layout.html'}}
</head>
<script>
$(document).ready(function() { 
  jQuery('.smarttable').dataTable(); 
});
</script>
<h1>Resultado das Provas</h1>
<table border=1 class="smarttable">
<thead>
<tr><th>Item</th><th>ID</th><th>Prova</th><th>Plano&nbsp;de&nbsp;Prova</th><th>Nome</th><th>Aplicação</th><th>Conclusão</th><th>Gerada</th><th>Enunciado</th><th>Resposta</th><th>Correta</th><th>Valor</th></tr>
</thead>
<tbody>
{{
def Capitalize(texto):
     return " ".join([i.lower()!="de" and i.capitalize() or "de" for i in texto.split()])
}}
{{for item, res in enumerate(resposta):}}
     <tr>
     <td>{{=item+1}}</td>
     <td>{{=res[0]}})</td>
     <td>{{=res[1]}}</td>
     <td>{{=res[2]}}</td>
     <td>{{=A(Capitalize(res[3] + ' ' + res[4]))}}</td>
     <td>
         {{if res[5]==None:}}
             {{="Não Aplicada"}}
         {{else:}}
             {{=res[5]}}
         {{pass}}    
     </td>
     <td>
        {{if res[6]==None:}}
             {{="Não Finalizada"}}
         {{else:}}
             {{=res[6]}}
         {{pass}}    
    </td>
     <td>
         {{if res[7]=="T" or res[7]==None:}}
             {{="Sim"}}
         {{else:}}
             {{="Não"}}
         {{pass}}    
     </td>
     <td>{{=res[8]}}</td>
     <td><p>
         {{if res[9]==None:}}
             {{="Não Respondida"}}
         {{else:}}
             {{=res[9]}}
         {{pass}}
         </p>    
     </td>
     <td>
         {{if res[10]=="T":}}
             {{="Sim"}}
         {{elif res[10]==None:}}
             {{="Não Respondida"}}
         {{else:}}
             {{="Não"}}
         {{pass}}
     </td>
     <td>{{=res[11]}}</td>
     </tr>
{{pass}}
</tbody>     
</table>
<br>
<table border=1 class="smarttable">
<thead>
<tr><td colspan=4>Resultado da Prova</td></tr>
<tr><th>Prova</th><th>Plano&nbsp;de&nbsp;Prova</th><th>Nome</th><th>Total de Pontos</th></tr>
</thead>
<tbody>
{{for res in totaliza:}}
     <tr>
     <td>{{=res[1]}}</td>
     <td>{{=res[2]}}</td>
     <td>{{=A(Capitalize(res[3] + ' ' + res[4]))}}</td>
     <td>{{=float(res[11])}}</td>
     </tr>
{{pass}}   
</tbody>  
</table>
